import os
import sys


from itertools import permutations as p
for i in p([1,2,3,4,5,6,7,8,9,10,11,12,14,16,17,18,19]):
  a1=16+13+i[0]
  a2=i[2]+i[3]+i[4]+i[1]
  a3=i[5]+i[6]+i[7]+i[8]+i[9]
  a4=i[10]+i[11]+i[12]+i[13]
  a5=i[14]+i[15]+i[16]
  a6=15+i[1]+i[5]
  a7=13+i[2]+i[6]+i[10]
  a8=i[0]+i[3]+i[7]+i[11]+i[14]
  a9=i[4]+i[8]+i[12]+i[15]
  a10=i[9]+i[13]+i[16]
  a11=i[0]+i[4]+i[9]
  a12=13+i[3]+i[8]+i[13]
  a13=15+i[2]+i[7]+i[12]+i[16]
  a14=i[1]+i[6]+i[11]+i[15]
  a15=i[5]+i[10]+i[14]
  if a1==a2==a3==a4==a5==a6==a7==a8==a9==a10==a11==a12==a13==a14==a15 :
    print(i[5],i[6],i[7],i[8],i[9])
    break

# print(9,6,5,2,16)